package ex7;

import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Test2 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Set<String> set = new TreeSet<String>();
		while (scanner.hasNextLine()) {
			String string = scanner.nextLine();
			if (string.equals("!!!!!")) {
				break;
			} else {
				if (string.length() == 0) {
					continue;
				}
				String[] strings = string.split(" +");
				for (String string2 : strings) {
					set.add(string2);
				}
			}
		}
		

		System.out.println(set.size());
        if (set.size() < 10) {
            for (String string : set) {
                System.out.println(string);
            }
        } else {
            int cnt = 0;
            for (String string : set) {
                System.out.println(string);
                cnt++;
                if (cnt == 10)
                    break;
            }
        }
		scanner.close();
	}
}